import { Form, Input, Select, Card, Image, Tag, Space, Upload, Row, Col } from 'myselfantd';
import React, { useEffect, useState } from 'react';
import styles from './index.module.scss';
import { add, getImplementsSpupInfos } from '@/services/api/farmtoolsmanage';
import moment from 'moment';
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
interface FormProps {
  data?: any;
  onFinish?: Function;
  handleFinish?: Function;
  viewmode?: 'view' | 'add' | 'edit';
}
const App: React.FC<FormProps> = ({ viewmode = 'add', data, onFinish: handleFinish }) => {
  const [machineOptions, setMachineOptions] = useState([]);
  const [form] = Form.useForm();
  if (data) {
    let formValue = {
      ...data,
      time: [
        moment(data.constraintsTimeStart, dateFormat),
        moment(data.constraintsTimeEnd, dateFormat),
      ],
    };
    form.setFieldsValue(formValue);
  } else {
    form.setFieldsValue({ type: 0 });
  }

  const onGenderChange = (value: string) => {};
  const handleUploadOnChange = (val: any) => {
    console.log(val, '0000000');
  };
  return (
    <div style={{ height: '300px' }}>
      <div>
        <span>农机名称</span>
        <Tag>拖拉机</Tag> <Tag>品牌：迪尔</Tag>
      </div>
      <Row>
        <Col span={18}>
          <Form.Layout
            viewmode={viewmode}
            formItemData={[
              [
                {
                  name: 'name1',
                  label: '农机型号',
                },
                {
                  name: 'machineCodes1',
                  label: '出厂编号',
                },
                {
                  name: 'machineCodes1',
                  label: '车架号',
                },
              ],
              [
                {
                  name: 'name2',
                  label: '所属品类',
                },
                {
                  name: 'name3',
                  label: '所属系统',
                },
                {
                  name: 'remark5',
                  label: '设备厂商',
                },
              ],
              [
                {
                  name: 'remark',
                  label: '农具图片',
                },
              ],
              [
                {
                  name: 'remark2',
                  label: '说明文字',
                },
              ],
            ]}
          />
        </Col>
        <Col span={6}>
          <Image />
        </Col>
      </Row>
    </div>
  );
};

export default App;
